<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Tools for Real-time Spectral Processing (pvs opcodes)</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="SpectralTop.html" title="Spectral Processing" />
    <link rel="prev" href="SpectralNonstand.html" title="Non-standard Spectral Processing" />
    <link rel="next" href="SpectralATS.html" title="ATS Spectral Processing" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Tools for Real-time Spectral Processing (pvs opcodes)</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="SpectralNonstand.html">Prev</a> </td>
          <th width="60%" align="center">Spectral Processing</th>
          <td width="20%" align="right"> <a accesskey="n" href="SpectralATS.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="section">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="SpectralRealTime"></a>Tools for Real-time Spectral Processing (pvs opcodes)</h2>
          </div>
        </div>
      </div>
      <p>
    With these opcodes,  two new core facilities are added to Csound. They offer improved audio quality, and fast performance, enabling high-quality analysis and resynthesis (together with transformations) to be applied in real-time to live signals. The original Csound phase vocoder remains unaltered; the new opcodes use an entirely separate set of functions based on <span class="quote">“<span class="quote">pvoc.c</span>”</span> in the CARL distribution, written by Mark Dolson. 
  </p>
      <p>
    The Csound <a class="link" href="dnoise.html" title="dnoise"><em class="citetitle">dnoise</em></a> and <a class="link" href="srconv.html" title="srconv"><em class="citetitle">srconv</em></a> utilities (also by Dolson, from CARL) also use this pvoc engine. CARL pvoc is also the basis for the phase vocoder included in the Composer's Desktop Project. A few small but important modifications have been made to the original CARL code to support real-time streaming.
  </p>
      <p>
    </p>
      <div class="orderedlist">
        <ol class="orderedlist" type="1">
          <li class="listitem">
            <p>Support for the new PVOC-EX analysis file format. This is a fully portable (cross-platform) open  file format, supporting three analysis formats, and multi-channel signals. Currently only the standard amplitude+frequency format has been implemented in the opcodes, but the file format itself supports amplitude+phase and  complex (real-imaginary) formats. In addition to the new opcodes, the original Csound pvoc opcodes have been extended (and thereby with enhanced audio quality in some cases)  to read PVOC-EX files as well as the original (non-portable) format.</p>
            <p>Full details of the structure of a PVOC-EX file are
        available via the website: <a class="ulink" href="http://www.cs.bath.ac.uk/~jpff/NOS-DREAM/researchdev/pvocex/pvocex.html" target="_top"><em class="citetitle">http://www.cs.bath.ac.uk/~jpff/NOS-DREAM/researchdev/pvocex/pvocex.html</em></a>. This
        site also gives details of the freely available console programs
        pvocex and pvocex2 which can be used to create PVOC-EX files in
        all supported formats.
      </p>
          </li>
          <li class="listitem">
            <p>
        A new frequency-domain signal type, fully
        streamable, with <span class="emphasis"><em>f</em></span> as the leading character.
        In this document it is conveniently referred to as an
        <span class="emphasis"><em>fsig</em></span>. Primary support for fsigs is provided
        by the opcodes pvsanal and pvsynth, which perform conventional
        phase vocoder overlap-add analysis and resynthesis, independently
        of the orchestra control-rate. The only requirement is that the
        control-rate kr be higher than or equal to the analysis rate,
        whch can be expressed by the requirement that ksmps &lt;=
        overlap, where overlap is the distance in samples between
        analysis frames, as specified for pvsanal. As overlap is
        typically at least 128, and more usually 256, this is not an
        onerous restriction in practice. The opcode pvsinfo can be used
        at init time to acquire the properties of an fsig.</p>
            <p>The fsig enables the nominal separation between the
      analysis and resynthesis stages of the phase vocoder to be
      exposed to the Csound programmer, so that not only can
      alternatives be employed for either or both of these stages (not
      only oscillator-bank resynthesis, but also the generation of
      synthetic fsig streams), but opcodes, operating on the fsig
      stream, can themselves become more elemental. Thus the fsig
      enables the creation of a true streaming plugin framework for
      frequency domain signals. With the old pvoc opcodes, each opcode
      is required to act as a resynthesiser, so that facilities such
      as pitch scaling are duplicated in each opcode; and in many
      cases the opcodes are parameter-rich. The separation of analysis
      and synthesis stages by means of the fsig encourages the
      development of a wide range of simple building-block opcodes
      implementing one or two functions, with which more elaborate
      processes can be constructed.
      </p>
          </li>
        </ol>
      </div>
      <p>
  </p>
      <p>
    This is very much a preliminary and experimental release, and it is possible that the precise definition of the opcodes may change, in response to user feedback. Also, clearly, many new possibilities for opcodes are opened up; these factors may also have a retrospective influence on the opcodes presented here.
  </p>
      <p>
    Note that some opcode parameters currently have restricted or
    missing implementation. This is at least in part in order to keep
    the opcodes simple at this stage, and also because they highlight
    important design issues on which no decision has yet been made,
    and on which opinions from users are sought.
  </p>
      <p>
    One important point about the new signal type is that because the
    analysis rate is typically much lower than kr, new analysis frames
    are not available on each k-cycle. Internally, the opcodes track
    ksmps, and also maintain a frame counter, so that frames are read
    and written at the correct times; this process is generally
    transparent to the user. However, it means that k-rate signals
    only act on an fsig at the analysis rate, not at each k-cycle.
    The opocde pvsftw returns a k-rate flag that is set when new fsig
    data is valid.
  </p>
      <p>
    Because of the nature of the overlap-add system, the use of these
    opcodes incurs a small but significant delay, or latency,
    determined by the window size (max(ifftsize,iwinsize)). This is
    typically around 23msecs. In this first release, the delay is
    slightly in excess of the theoretical minimum, and it is hoped
    that it can be reduced, as the opcodes are further optimized for
    real-time streaming.
  </p>
      <p>
    The opcodes for real-time spectral processing are
    <a class="link" href="pvsadsyn.html" title="pvsadsyn"><em class="citetitle">pvsadsyn</em></a>,
    <a class="link" href="pvsanal.html" title="pvsanal"><em class="citetitle">pvsanal</em></a>,
    <a class="link" href="pvscross.html" title="pvscross"><em class="citetitle">pvscross</em></a>,
    <a class="link" href="pvsfread.html" title="pvsfread"><em class="citetitle">pvsfread</em></a>,
    <a class="link" href="pvsftr.html" title="pvsftr"><em class="citetitle">pvsftr</em></a>,
    <a class="link" href="pvsftw.html" title="pvsftw"><em class="citetitle">pvsftw</em></a>,
    <a class="link" href="pvsinfo.html" title="pvsinfo"><em class="citetitle">pvsinfo</em></a>,
    <a class="link" href="pvsmaska.html" title="pvsmaska"><em class="citetitle">pvsmaska</em></a>, and
    <a class="link" href="pvsynth.html" title="pvsynth"><em class="citetitle">pvsynth</em></a>.
  </p>
      <p>
    In addition there are a number of opcodes available as plugins in
    Csound5,and in the core for Csound6.  These are
    <a class="link" href="pvstanal.html" title="pvstanal"><em class="citetitle">pvstanal</em></a>,
    <a class="link" href="pvsdiskin.html" title="pvsdiskin"><em class="citetitle">pvsdiskin</em></a>,
    <a class="link" href="pvscent.html" title="pvscent"><em class="citetitle">pvscent</em></a>,
    <a class="link" href="pvsdemix.html" title="pvsdemix"><em class="citetitle">pvsdemix</em></a>,
    <a class="link" href="pvsfreeze.html" title="pvsfreeze"><em class="citetitle">pvsfreeze</em></a>,
    <a class="link" href="pvsbuffer.html" title="pvsbuffer"><em class="citetitle">pvsbuffer</em></a>,
    <a class="link" href="pvsbufread.html" title="pvsbufread"><em class="citetitle">pvsbufread</em></a>,
    <a class="link" href="pvsbufread.html" title="pvsbufread"><em class="citetitle">pvsbufread2</em></a>,
    <a class="link" href="pvscale.html" title="pvscale"><em class="citetitle">pvscale</em></a>,
    <a class="link" href="pvshift.html" title="pvshift"><em class="citetitle">pvshift</em></a>,
    <a class="link" href="pvsifd.html" title="pvsifd"><em class="citetitle">pvsifd</em></a>,
    <a class="link" href="pvsinit.html" title="pvsinit"><em class="citetitle">pvsinit</em></a>,
    <a class="link" href="pvsin.html" title="pvsin"><em class="citetitle">pvsin</em></a>,
    <a class="link" href="pvsout.html" title="pvsout"><em class="citetitle">pvsout</em></a>,
    <a class="link" href="pvsosc.html" title="pvsosc"><em class="citetitle">pvsosc</em></a>,
    <a class="link" href="pvsbin.html" title="pvsbin"><em class="citetitle">pvsbin</em></a>,
    <a class="link" href="pvsdisp.html" title="pvsdisp"><em class="citetitle">pvsdisp</em></a>,
    <a class="link" href="pvsfwrite.html" title="pvsfwrite"><em class="citetitle">pvsfwrite</em></a>,
    <a class="link" href="pvslock.html" title="pvslock"><em class="citetitle">pvslock</em></a>,
    <a class="link" href="pvsmix.html" title="pvsmix"><em class="citetitle">pvsmix</em></a>,
    <a class="link" href="pvsmooth.html" title="pvsmooth"><em class="citetitle">pvsmooth</em></a>,
    <a class="link" href="pvsfilter.html" title="pvsfilter"><em class="citetitle">pvsfilter</em></a>,
    <a class="link" href="pvsblur.html" title="pvsblur"><em class="citetitle">pvsblur</em></a>,
    <a class="link" href="pvstencil.html" title="pvstencil"><em class="citetitle">pvstencil</em></a>,
    <a class="link" href="pvsarp.html" title="pvsarp"><em class="citetitle">pvsarp</em></a>,
    <a class="link" href="pvsvoc.html" title="pvsvoc"><em class="citetitle">pvsvoc</em></a>,
    <a class="link" href="pvsmorph.html" title="pvsmorph"><em class="citetitle">pvsmorph</em></a>,
    <a class="link" href="pvsbandp.html" title="pvsbandp"><em class="citetitle">pvsbandp</em></a>,
    <a class="link" href="pvsbandr.html" title="pvsbandr"><em class="citetitle">pvsbandr</em></a>,
    <a class="link" href="pvswarp.html" title="pvswarp"><em class="citetitle">pvswarp</em></a>,
    <a class="link" href="pvsgain.html" title="pvsgain"><em class="citetitle">pvsgain</em></a>,
    <a class="link" href="pvs2tab.html" title="pvs2tab"><em class="citetitle">pvs2tab</em></a>,
    <a class="link" href="tab2pvs.html" title="tab2pvs"><em class="citetitle">tab2pvs</em></a>.
  </p>
      <p>
   A number of opcodes are designed to generate and process streaming
partials tracks data. these are
    <a class="link" href="partials.html" title="partials"><em class="citetitle">partials</em></a>,
    <a class="link" href="trcross.html" title="trcross"><em class="citetitle">trcross</em></a>,
    <a class="link" href="trfilter.html" title="trfilter"><em class="citetitle">trfilter</em></a>,
    <a class="link" href="trsplit.html" title="trsplit"><em class="citetitle">trsplit</em></a>,
    <a class="link" href="trmix.html" title="trmix"><em class="citetitle">trmix</em></a>,
    <a class="link" href="trscale.html" title="trscale"><em class="citetitle">trscale</em></a>,
    <a class="link" href="trshift.html" title="trshift"><em class="citetitle">trshift</em></a>,
    <a class="link" href="trlowest.html" title="trlowest"><em class="citetitle">trlowest</em></a>,
    <a class="link" href="trhighest.html" title="trhighest"><em class="citetitle">trhighest</em></a>
    <a class="link" href="tradsyn.html" title="tradsyn"><em class="citetitle">tradsyn</em></a>,
    <a class="link" href="sinsyn.html" title="sinsyn"><em class="citetitle">sinsyn</em></a>,
    <a class="link" href="resyn.html" title="resyn"><em class="citetitle">resyn</em></a>,
    <a class="link" href="binit.html" title="binit"><em class="citetitle">binit</em></a>

  </p>
      <p>
    See the <a class="link" href="ControlStacks.html" title="Stacks"><em class="citetitle">Stacks</em> section for information on the stack opcodes which can stack f-signals.</a>
  </p>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="SpectralNonstand.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="SpectralTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="SpectralATS.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Non-standard Spectral Processing </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> ATS Spectral Processing</td>
        </tr>
      </table>
    </div>
  </body>
</html>
